const a = function (
  _01,
  _02,
  { params = {} },
  { dc: { open, reload, setModal, close } }
) {
  const transfer = params;
  const layout = { id: "1788812530857660417" };
  const modal = {
    title: "新增审核",
    width: "75vw",
    minHeight: document.body.clientHeight * 0.7,
    defaultFullscreen: false,
    destroyOnClose: true,
    maskClosable: false,
    centered: true,
    open: true,
    showOkBtn: true,
    showCancelBtn: true,
  };
  const inner = {
    onOk: async function (
      _,
      { memory },
      { xe: { get }, dc: { http, message } }
    ) {
      const checkList = [
        ...get(memory, "checkListBonus", []),
        ...get(memory, "checkListBx", []),
      ];
      if (!checkList.length) return message.info("请至少选择一条数据");
      setModal({ confirmLoading: true });
      try {
        const errorList = [];
        function toUp(str) {
          let newStr = "";
          let arr = str.split("_");
          arr.forEach((item, index) => {
            if (index > 0) {
              return (newStr += item.replace(item[0], item[0].toUpperCase()));
            } else {
              return (newStr += item);
            }
          });
          return newStr;
        }
        for (const item of checkList) {
          const params = {};
          Object.keys(item).forEach((key) => {
            params[toUp(key)] = item[key];
          });
          const res = await http.post(
            {
              url: "/ypxy/transfer/submit",
              data: { ...params, id: undefined },
            },
            { isTransformResponse: false }
          );
          if (res.code !== 200) {
            errorList.push(params.programName);
          }
        }
        if (errorList.length) {
          message.error(`项目${errorList.join(",")}审核失败`);
        } else {
          message.success("提交审核成功");
        }
        setModal({ confirmLoading: false });
        close();
        if (errorList.length !== checkList.length) {
          reload();
        }
      } catch (error) {
        setModal({ confirmLoading: false });
      }
    },
  };
  open({ inner, layout, modal, transfer });
};
